<template>
  <div id="app" class="app">
    <header class="app-header">
      <h1>TripMateAI (旅游伙伴AI)</h1>
      
      <nav>
        <router-link to="/">首页</router-link>
        <router-link to="/trip-chat">AI旅游推荐</router-link>
        <router-link to="/manus-chat">AI智能体</router-link>
      </nav>
    </header>
    <main>
      <router-view />
    </main>
  </div>
</template>

<script setup>
import { useLoginUserStore } from './stores/useLoginUserStore'
import { storeToRefs } from 'pinia'
import { computed } from 'vue'
import { useRouter } from 'vue-router'

// 用户状态管理
const loginUserStore = useLoginUserStore()
const { loginUser } = storeToRefs(loginUserStore)
const { logout } = loginUserStore

const isUserLoggedIn = computed(() => loginUserStore.isLoggedIn)

// 处理登出
const handleLogout = () => {
  logout()
  // 可以添加登出后的其他逻辑
}
</script>

<style scoped>
.app {
  width: 100%;
  max-width: 100vw;
  margin: 0;
  padding: 0;
  
}

.app-header {
  background-color: #ffffff;
  color: #111827;
  padding: 0 16px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: none;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header h1 {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}

nav {
  display: flex;
  gap: 16px;
}

router-link {
  color: #6b7280;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

router-link:hover {
  color: #374151;
  background-color: #f3f4f6;
}

router-link.router-link-active {
  color: #667eea;
  background-color: #f3f4f6;
  font-weight: 600;
}

main {
  margin: 0;
  padding: 0;
  max-width: none;
  height: calc(100vh - 48px);
  overflow: hidden;
}

/* 用户状态样式 */
.user-status {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  color: white;
}

.logout-btn {
  background-color: #e74c3c;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.3s;
}

.logout-btn:hover {
  background-color: #c0392b;
}
</style>
